//
//  loginViewController.m
//  Family
//
//  Created by 王声䘵 on 2018/5/3.
//  Copyright © 2018年 王声䘵. All rights reserved.
//

#import "loginViewController.h"
#import "UserViewController.h"
#import "MyNavigationController.h"
#import "RegisterViewController.h"
#import "MenuViewController.h"
#import "Singleton.h"
@interface loginViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *UserNameText;
@property (weak, nonatomic) IBOutlet UITextField *passWordText;

@end

@implementation loginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _UserNameText.delegate=self;
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//点击确定butten
- (IBAction)loginSuccess:(id)sender {
    Singleton *UserName=[Singleton create];
    UserName.UserName=_UserNameText.text;
    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count] -2)] animated:YES];
//    UserViewController *userView=[[UserViewController alloc]init];
//    [self.navigationController popToViewController:userView animated:YES];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    //回收键盘,取消第一响应者
    [textField resignFirstResponder];
    return YES;
}
//取消登录
- (IBAction)cancel:(id)sender {
//    UserViewController *User=[[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"userView"];
    [self.navigationController popViewControllerAnimated:YES];
}
//跳转注册界面
- (IBAction)register:(id)sender {
    RegisterViewController *Register=[[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"register"];
    [self.navigationController pushViewController:Register animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
